package com.mcr.graduateprogram.filter;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

@Configuration
public class MyMetaObjecthandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        metaObject.setValue("createTime", Date.from(LocalDateTime.now().atZone( ZoneId.systemDefault()).toInstant()));
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
